'use strict';


const db = uniCloud.database();
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event',event);
	let keyList = ['头像','男头','女头','动漫头像','情头','表情包','壁纸','qq头像','女生图片','大图','美图','图片','动漫图片','空间素材','素材'];
	let nowIndex=  0;
	while(nowIndex < keyList.length){
		let countRes = await db.collection('title').where({
			name:keyList[nowIndex]
		}).count();
		let total = countRes['total'];
		if(total === 0) await db.collection('title').add({name:keyList[nowIndex]});
		nowIndex++;
	}

	
	//返回数据给客户端
	return 'tempRes';
};
